import React, {createContext, useContext} from 'react';
import {useLocalStorage} from '@rehooks/local-storage';

const AuthContext = createContext();

export const useAuth = () => useContext(AuthContext);

const AuthProvider = ({children}) => {
    const [user,setUser,deleteUser] = useLocalStorage('user',{});

    return (
        <AuthContext.Provider value={{user,setUser,deleteUser}}>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthProvider;